Decode의 사용 :: 오라클 실습[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

오라클 실습
[1]
등록일:2009-05-28 00:06:28 (0%)
작성자:
제목:Decode의 사용
Row들에  대해서  Count,  Sum의  연산을  하게  되는데  이때  Decode를  사용하면  성능이  향상된다.

Select  count(*),  sum(sal)
From    emp
Where  deptno  =  1000
And      ename  like  ‘김%’

Select  count(*),  sum(sal)
From    emp
Where  deptno  =  3000
And      ename  like  ‘김%’

<개선안>
Select  count(decode(deptno,  1000,  ‘x’,  null))  dept1000_count,
                      count(decode(deptno,  3000,  ‘x’,  null))  dept3000_count,
                        sum(decode(deptno,  1000,  sal,  null)  dept1000_sal,
                        sum(decode(deptno,  3000,  sal,  null)  dept3000_sal
From  emp
Where  ename  like  ‘김%’;
[본문링크] Decode의 사용
[1]
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=31486
작성자
비밀번호

 

SSISOCommunity

[이전]

Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.